#ifndef SIMFRAMEWORK_JSON_JSON_PARSER_H
#define SIMFRAMEWORK_JSON_JSON_PARSER_H

#include "private_implementations/JsonNode.h"

namespace simframework
{
	namespace json
	{

		class JsonParser
		{
		public:
			JsonParser(const std::wstring& str);

			IJsonNode* parse();

		private:
			std::wstring jsonString_;
			std::wstring::iterator begin_, end_, current_;

			IJsonNode* getValue(std::wstring::iterator& current, std::wstring::iterator& end, const std::wstring& key);
			JsonObjectNode* getJsonObjectNode(std::wstring::iterator& current, std::wstring::iterator& end, const std::wstring& parentKey);
			JsonArrayNode* getJsonArrayNode(std::wstring::iterator& current, std::wstring::iterator& end, const std::wstring& parentKey);
			JsonStringNode* getJsonStringNode(std::wstring::iterator& current, std::wstring::iterator& end, const std::wstring& key);
			JsonDoubleNode* getJsonDoubleNode(std::wstring::iterator& current, std::wstring::iterator& end, const std::wstring& key);
			JsonBoolNode* getJsonBoolNode(std::wstring::iterator& current, std::wstring::iterator& end, const std::wstring& key);
			JsonNullNode* getJsonNullNode(std::wstring::iterator& current, std::wstring::iterator& end, const std::wstring& key);
			std::wstring getString(std::wstring::iterator& current, std::wstring::iterator& end);
		};
	}
}

#endif //SIMFRAMEWORK_JSON_JSON_PARSER_H